package D;

public class Test {
    public static void cooking(Vegetables vegetables){
        vegetables.cooking();
    }
    public static void main(String[] args) {
        Vegetables vegetables = new Vegetables("烧烤");
        vegetables.cooking();
        vegetables.use();
        Vegetables vegetables1 = new Cucumber("凉拌");
        vegetables1.cooking();
        if (vegetables instanceof Eggplant){
            Eggplant eggplant = (Eggplant)vegetables;
            eggplant.use();
        }else {
            System.out.println("类型不对");
        }
    }
}
